﻿@model IEnumerable<CloudFranceTriple.Models.PollAnswerSet>
<table style="border: 1px solid #fffffe; margin-left: 5px; width: 288px;">
    @foreach (var answer in Model)
    {
        <tr>
            <td style="border: 1px solid #fffffe; border-radius: 8px; padding: 0; margin: 0;">
                <div class="poll-field">
                    @Html.DisplayFor(answerItem => answer.LabelPollAnwser)
                </div>
                <div class="poll-field">
                    @if (ViewBag.IsPublicPollResult & ViewBag.ShowResults )
                    {
                        @Html.Action("ShowWhoPolledWhat", "PollAnswer", new { area = "Forum", id = answer.Id })
                    }
                </div>
            </td>
            @if (ViewBag.ShowResults || ViewBag.HasPolled)
            {
                <td style="border: 1px solid #fffffe; border-radius: 8px;">
                    <div class="poll-field">
                        @Html.DisplayFor(answerItem => answer.NumberVotePollAnswer)
                    </div>
                </td>
            }
            else
            {
                if ((!User.Identity.IsAuthenticated & !ViewBag.IsRecuitPoll) ||
                    (User.Identity.IsAuthenticated & !ViewBag.HasPolled & !ViewBag.ShowResults & (!ViewBag.IsMemberOnlyPoll | (User.IsInRole("RoleMember") & ViewBag.IsMemberOnlyPoll))))
                {
                <td>
                    @Html.ActionLink(CloudFranceTriple.WebRole.Properties.Resources.ButtonPoll, "Poll", "Poll", new { id = answer.Id, area = "Forum" }, null)
                </td>
                }
            }
            <td>
                @if (ViewBag.IsAuthor & !ViewBag.HasPolled & !ViewBag.ShowResults)
                {
                    @Html.ActionLink(CloudFranceTriple.WebRole.Properties.Resources.ButtonEdit, "Edit", "PollAnswer", new { id = answer.Id }, null);
                    @Html.ActionLink(CloudFranceTriple.WebRole.Properties.Resources.ButtonDelete, "Delete", "PollAnswer", new { id = answer.Id }, null);
                }
            </td>
        </tr>
    }
    @if (ViewBag.IsAuthor & !ViewBag.HasPolled & !ViewBag.ShowResults)
    {
        <tr>
            <td style="border: 1px solid #fffffe; border-radius: 8px; padding: 0; margin: 0;">
                <div class="poll-field" style="padding-right: 10px;">
                    @Html.Action("Create", "PollAnswer", new { area = "Forum", id = ViewBag.Poll_Id })
                </div>
            </td>
        </tr>
    }
</table>
@if (User.Identity.IsAuthenticated & !ViewBag.ShowResults & ViewBag.HasPolled & (!ViewBag.IsRecuitPoll | (!ViewBag.IsTopicAuthor & ViewBag.IsRecuitPoll)))
{
    @Html.ActionLink(CloudFranceTriple.WebRole.Properties.Resources.PollUnpollMyPoll, "Unpoll", "Poll", new { id = ViewBag.Poll_Id, area = "Forum" }, null)
}